package io.writeFile;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @program: javase
 * @description:
 * @author: luolidong
 * @create: 2021-06-28 22:43
 * @version: 1.0
 */
public class PrintWriteTest {
    public static void main(String[] args) throws IOException {
        FileWriter fileWriter = new FileWriter("./other/src/io/writeFile/log.txt");
        PrintWriter printWriter = new PrintWriter(fileWriter);
        for (int i = 0; i < 100; i++) {
            final int a = i;
            new Thread(() -> {
                printWriter.println(Thread.currentThread().getName() + " " + Thread.currentThread().getState());
            }, "线程" + a).start();
        }
        printWriter.close();
        fileWriter.close();
    }
}
